package com.bnz.exception;

import com.bnz.pojo.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class HanderException {
    @ExceptionHandler(TestException.class)
    public R handerError(TestException ex){
        String mag = "未知异常！";
        // 得到出错传来的信息
        if (ex != null){
            mag = ex.getMessage();
        }
        return R.error(500,mag);
    }
}
